package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * 用车记录表
 */

@Entity
@Table
public class Record implements Serializable{

	private static final long serialVersionUID = -2144485347980077512L;
	
	private Integer code;
	private String vc;				//车牌号
	private Integer vu;				//用车人编号
	private Boolean deleted;		//是否删除
	private Date ctime;				//归还时间
	private Integer oc;				//机构编号
	private Integer driver;			// 驾驶员
	private Integer km;				// 行驶距离
	
	//@Formula
	private String cun;				//用车人
	private String on;				//机构名称
	private String dname;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getVu() {
		return vu;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Date getCtime() {
		return ctime;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = vu)")
	public String getCun() {
		return cun;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Column
	public Integer getDriver() {
		return driver;
	}
	@Column
	public Integer getKm() {
		return km;
	}
	@Column
	public String getVc() {
		return vc;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = driver)")
	public String getDname() {
		return dname;
	}

	
	
	
	
	
	
	
	
	public void setDname(String dname) {
		this.dname = dname;
	}

	public void setVc(String vc) {
		this.vc = vc;
	}

	public void setKm(Integer km) {
		this.km = km;
	}

	public void setDriver(Integer driver) {
		this.driver = driver;
	}

	public void setCun(String cun) {
		this.cun = cun;
	}

	public void setOn(String on) {
		this.on = on;
	}

	public void setCode(Integer code) {
		this.code = code;
	}
	
	public void setVu(Integer vu) {
		this.vu = vu;
	}
	
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	
	public void setCtime(Date ctime) {
		this.ctime = ctime;
	}
	
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	

}
